<template>
    <div class="page">
        <div class="page_header" style="display: flex;">
            <div style="flex: 1 1 auto">
                <el-form ref="searchForm" :model="searchForm" style="display: flex;">
                    <el-form-item prop="we_id">
                        <el-input v-model="searchForm.we_id" placeholder="用户id"></el-input>
                    </el-form-item>
                    <el-form-item prop="openid">
                        <el-input v-model="searchForm.openid" placeholder="openid"></el-input>
                    </el-form-item>
                    <el-form-item prop="nickname">
                        <el-input v-model="searchForm.nickname" placeholder="微信昵称"></el-input>
                    </el-form-item>
                </el-form>
            </div>
            <div style="flex:0 0 auto;">
                <el-button @click="$store.dispatch('tableReload')" type="primary">查询</el-button>
                <el-button @click="$store.dispatch('tableReset')">重置</el-button>
            </div>
        </div>
        <el-card class="page_body">
            <el-table
                height="10"
                class="page_body_table"
                :data="common.tableData"
                v-loading="common.loading"
                border
                stripe
                style="width: 100%">
                <el-table-column prop="we_id" width="80" label="用户id"></el-table-column>
                <el-table-column prop="openid" width="250" label="openid"></el-table-column>
                <el-table-column prop="nickname" label="微信昵称">
                    <template slot-scope="scope">
                        <el-button type="text" @click="$refs.shopKeeperDialog.init(scope.row.we_id)">{{scope.row.nickname}}</el-button>
                    </template>
                </el-table-column>
                <el-table-column prop="shop_count" label="店铺数量"></el-table-column>
                <el-table-column prop="channel_remaining" label="探店余量"></el-table-column>
                <el-table-column prop="channel_in_use" label="正在使用"></el-table-column>
                <el-table-column prop="lottery_remaining" label="霸王餐余量"></el-table-column>
                <el-table-column prop="lottery_in_use" label="正在使用"></el-table-column>
            </el-table>
            <pagination class="page_body_pagination"></pagination>
        </el-card>
        <shop-keeper-dialog ref="shopKeeperDialog" @refresh="$store.dispatch('tableReload')"></shop-keeper-dialog>
    </div>
</template>

<script>
    import {mapState} from 'vuex';
    import Pagination from "../Pagination";
    import ShopKeeperDialog from "./Dialog/ShopKeeperDialog";
    export default {
        name: "ShopKeeper",
        computed:{
            ...mapState(['common','laifei']),
        },
        components: {
            Pagination,
            ShopKeeperDialog,
        },
        data(){
            return{
                method:'post',
                url:'/api/laifei/shopkeeper/store',
                searchForm:{
                    // shop_id:'',
                    // shop_name:'',
                    // contact_man:'',
                    // contact_phone:'',
                    // openid:'',
                    // nickname:'',
                    // phone:'',
                    // verified:1,
                },
            }
        },
        created() {
            this.$store.dispatch('pageInit', this);
        },
    }
</script>

<style scoped>

</style>
